package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/04/19 10:48
 **/
public class Day2_1_SortedCount {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int[] arr = new int[a+1];
        for(int i = 0 ; i < a;i++){
            arr[i] = in.nextInt();
        }

        int i = 0;
        int count = 0;
        while(i < a){
            if(arr[i] < arr[i+1]){
                while((i < a) && arr[i] < arr[i+1]) {
                    i++;
                }
                count ++;
                i++;
            }else if(arr[i] == arr[i+1]){
                while ((i < a ) && arr[i] == arr[i+1]){
                    i++;
                }
            }else {
                while((i < a) && arr[i] > arr[i+1]){
                    i++;
                }
                count++;
                i++;
            }
        }
        System.out.println(count);
    }
}